{% extends 'base_top.html' %}

{% block title %}
    搜索[{{ query }}]
{% endblock %}

{% block body %}


    <div class="main_wrap clearfix">

        <div class="l_wrap fl clearfix">
			{% include 'df_goods/new_goods.html' %}
		</div>

		<div class="r_wrap fr clearfix">
            <h3 style="font-size: 24px;">搜索结果如下：</h3>
			<ul class="goods_type_list clearfix">

                {% if query %}

                    {% for result in page_obj.object_list %}
                        {% if result.object %}
                            <li>
                                <a href="{% url 'detail' result.object.id %}"><img src="/static/{{ result.object.gpic }}"></a>
                                <h4><a href="{% url 'detail' result.object.id %}">{{ result.object.ttitle }}</a></h4>
                                <div class="operate">
                                    <span class="prize">￥{{ result.object.gprice }}</span>
                                    <span class="unit">{{ result.object.gprice }}/{{ result.object.gunit }}</span>
                                    <a href="{% url 'add' %}?gid={{ result.object.id }}" class="add_goods" title="加入购物车"></a>
                                </div>
                            </li>
                        {% else %}
                            <p>啥也没找到</p>
                        {% endif %}

                    {% endfor %}

                {% endif %}


			</ul>

        {% if page_obj.has_previous or page_obj.has_next %}
            <div style="text-align: center">
                {% if page_obj.has_previous %}<a href="?q={{ query }}&amp;page={{ page_obj.previous_page_number }}">{% endif %}&laquo; 上一页{% if page_obj.has_previous %}</a>{% endif %}
            |
                {% if page_obj.has_next %}<a href="?q={{ query }}&amp;page={{ page_obj.next_page_number }}">{% endif %}下一页 &raquo;{% if page_obj.has_next %}</a>{% endif %}
            </div>
        {% endif %}



		</div>
	</div>

{% endblock %}